#pragma once
#include "cocos2d.h"
#include "PlayerBoard.h"

using namespace cocos2d;

class ForSaleBoard : public Layer
{
	int m_nCardCount = 0;
	Vector<Sprite*> m_rgHourseCardSprits;
	Vector<Sprite*> m_rgMoneyCardSprits;
	Vector<Sprite*> m_rgSellingHourseCardSprites;

	PlayerBoard* m_pPlayerBoard = nullptr;

	~ForSaleBoard();

	virtual bool init() override;
	void showAHourseCard();
	Point getCardPosition();
	void showAMoneyCard();

	void onSetButtonClicked(Ref* obj);
	void onExitButtonClicked(Ref* obj);
	void onFirstHourseCalled(Ref* obj);
	void onLastHourseCalled(Ref* obj);

	void playComCallPriceAnimation(Ref* obj);
	void playComGetHourseAnimation(Ref* obj);
	void playComSellHourseAnimation(Ref* obj);

	void showASellingHourseCard(Ref* obj);
	void giveMoneyCardsToPlayers();

	void removeAllHourseCards(Ref* obj);

public:
	void showNewRoundCards(Ref* obj);
	void setPlayerBoard(PlayerBoard* pPlayerBoard) { m_pPlayerBoard = pPlayerBoard; }

	CREATE_FUNC(ForSaleBoard);
};

